package com.demo.ms.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.demo.ms.pojo.User;
import com.demo.ms.service.UserService;


@Controller
public class UserController {
	@Resource
	private UserService userService;

	@RequestMapping("/user/login")
	public String login(HttpServletRequest request, Model model){
		String name = request.getParameter("name");
		String password =request.getParameter("password");
		User user = this.userService.login(name, password);
		if(null!=user){
			model.addAttribute("user", user);
			return "show";
		}else{
			return "hello";
		} 
		
	}
}
